<!doctype html>
<html>
<head>
<script src="http://www.parsecdn.com/js/parse-1.2.13.min.js"></script>
<script>
        Parse.initialize("fcHaeM3NTQytOFF2V86hQ8hWlRSLvx7A1ToPSS8B", 
        "82Tj0ZB1okXfarwmrYDY6yrzFAJGRJDcYEDZPe9u");
    </script>
<meta charset="utf-8">
<title>Test add event</title>
</head>

<body>
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
    // init the FB JS SDK
  Parse.FacebookUtils.init({
    appId      : '646326408744235', // Facebook App ID
    status     : true, // check login status
    cookie     : true, // enable cookies to allow Parse to access the session
    xfbml      : true  // parse XFBML
  });

    // Additional initialization code such as adding Event Listeners goes here
  };

  // Load the SDK asynchronously
  (function(){
     // If we've already installed the SDK, we're done
     if (document.getElementById('facebook-jssdk')) {return;}

     // Get the first script element, which we'll use to find the parent node
     var firstScriptElement = document.getElementsByTagName('script')[0];

     // Create a new script element and set its id
     var facebookJS = document.createElement('script'); 
     facebookJS.id = 'facebook-jssdk';

     // Set the new script's source to the source of the Facebook JS SDK
     facebookJS.src = '//connect.facebook.net/en_US/all.js';

     // Insert the Facebook JS SDK into the DOM
     firstScriptElement.parentNode.insertBefore(facebookJS, firstScriptElement);
	 
	 FB.getLoginStatus(function(response) {
  if (response.status === 'connected') {
    // the user is logged in and has authenticated your
    // app, and response.authResponse supplies
    // the user's ID, a valid access token, a signed
    // request, and the time the access token 
    // and signed request each expire
    var uid = response.authResponse.userID;
    var accessToken = response.authResponse.accessToken;
	window.alert(response.status + uid + accessToken);
  } else if (response.status === 'not_authorized') {
    
	window.alert(response.status);
	// the user is logged in to Facebook, 
    // but has not authenticated your app
  } else {
    // the user isn't logged in to Facebook.
	window.alert(response.status);
  }
 });
   }());
</script>
</body>
</html>
